package com.example.barcodeapp.ui.wode.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.example.barcodeapp.R;
import com.example.barcodeapp.ui.wode.bean.JiFengBiJiLuBean;

import java.util.List;

public class JiFeengBiJiLuAdapter extends RecyclerView.Adapter<JiFeengBiJiLuAdapter.ViewHolder> {
    private Context context;
    private List<JiFengBiJiLuBean.DataEntity> list;
    public JiFeengBiJiLuAdapter(Context context) {
        this.context = context;
    }

    public JiFeengBiJiLuAdapter(Context context, List<JiFengBiJiLuBean.DataEntity> list) {
        this.context = context;
        this.list = list;
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View inflate = LayoutInflater.from(context).inflate(R.layout.adapter_jifengbijilu, parent, false);
        return new ViewHolder(inflate);
    }

    @Override
    public void onBindViewHolder(@NonNull ViewHolder holder, int position) {

        if (list.get(position).getShijiprice().isEmpty()){
            holder.textView55.setText(list.get(position).getShijiprice());
        }
        if (list.get(position).getPaytime().isEmpty()){
            holder.textView55.setText(list.get(position).getPaytime());
        }
    }

    @Override
    public int getItemCount() {
        return list.size();
    }



    public class ViewHolder extends RecyclerView.ViewHolder {

        private TextView textView53;
        private TextView textView55;
        private TextView textView56;

        public ViewHolder(@NonNull View itemView) {
            super(itemView);
            textView53 = (TextView) itemView.findViewById(R.id.textView53);
            textView55 = (TextView) itemView.findViewById(R.id.textView55);
            textView56 = (TextView) itemView.findViewById(R.id.textView56);
        }
    }
}
